@extends('layouts.app')

@section('title','trainList')

@section('content')
    <div class="container">
        <div class="row">
            <div class="col-md-12">
                <header class="list-header">
                    <section>培训管理</section>
                    <section>
                        <a type="submit" href="{{ route('train.create') }}" class="add">
                            <i class="fa fa-plus-circle fa-lg" aria-hidden="true"></i>&nbsp;Add Train
                        </a>
                    </section>
                </header>

                        <table class="table table-hover table-striped list-table">
                            <tr class="list-table-tr">
                                <th> 培训名称</th>
                                <th>培训图片</th>
                                <th>培训时间</th>
                                <th>报名人数</th>
                                <th class="text-right">Operation</th>
                            </tr>
                            @foreach($trains as $v)
                                   <tr>
                                    <td> {{ $v->train_name }}</td>
                                    <td> <img src="/uploads/avatars/{{ $v->train_picture }}" width="50px"/></td>
                                    <td>{{ $v->train_date }}</td>
                                    <td><a href="{{ URL('admin/trainOrder/'.$v->train_id)}}">{{$v->counts}}</a></td>
                                    <td class="text-right">
                                            {{--<a href="{{ URL('admin/train/'.$v->id.'/edit') }}" class="btn btn-success">修改</a>--}}
                                        <a  href="{{ URL('admin/train/'.$v->id.'/edit') }}" class="edit">
                                            <i class="fa fa-pencil-square-o fa-lg" aria-hidden="true"></i>
                                        </a>

                                        <form action="{{ URL('admin/train/'.$v->id) }}" method="POST" style="display: inline;">
                                            <input name="_method" type="hidden" value="DELETE">
                                            <input type="hidden" name="_token" value="{{ csrf_token() }}">
                                            <button type="submit" class="delete"><i class="fa fa-trash-o fa-lg" aria-hidden="true"></i></button>
                                        </form>
                                    </td>
                                </tr>
                            @endforeach
                        </table>
                        <hr>
                        {!! $trains->render() !!}
                    </div>
                </div>
            </div>
        </div>
    </div>

@endsection